<!DOCTYPE html>
<html> 
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>外检信息</title> 
    <link rel="shortcut icon" href="favicon.ico">
	<#import "/common/import.ftl" as import>
    <@import.tableManagerImportCss/>
    <link href="${WEB_PATH}/resources/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
 	<style>
    	.demo:after {
		    background-color: #F5F5F5;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px 0 4px 0;
		    color: #9DA0A4;
		    content: "条件查询：";
		    font-size: 12px;
		    font-weight: bold;
		    left: -1px;
		    padding: 3px 7px;
		    position: absolute;
		    top: -1px;
		}
		.demo {
		    margin-left: 0px;
		    padding:40px 15px 0px;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px;
		    position: relative;
		    word-wrap: break-word;
		}
		.account:after {
		    background-color: #F5F5F5;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px 0 4px 0;
		    color: #9DA0A4;
		    content: "外检信息";
		    font-size: 12px;
		    font-weight: bold;
		    left: -1px;
		    padding: 3px 7px;
		    position: absolute;
		    top: -1px;
		}
		.account {
		    margin-left: 0px;
		    padding:40px 15px 0px;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px;
		    position: relative;
		    word-wrap: break-word;
		    margin-top: 10px;
		}
		
		.jyjg:after {
		    background-color: #F5F5F5;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px 0 4px 0;
		    color: #9DA0A4;
		    content: "检测机构";
		    font-size: 12px;
		    font-weight: bold;
		    left: -1px;
		    padding: 3px 7px;
		    position: absolute;
		    top: -2px;
		}
		.jyjg {
		    margin-left: 0px;
		    padding:40px 15px 0px;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px;
		    position: relative;
		    word-wrap: break-word;
		}
		
		.czxx:after {
		    background-color: #F5F5F5;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px 0 4px 0;
		    color: #9DA0A4;
		    content: "车主信息";
		    font-size: 12px;
		    font-weight: bold;
		    left: -1px;
		    padding: 3px 7px;
		    position: absolute;
		    top: -1px;
		}
		.czxx {
		    margin-left: 0px;
		    margin-top: 10px;
		    padding:40px 15px 0px;
		    border: 1px solid #DDDDDD;
		    border-radius: 4px;
		    position: relative;
		    word-wrap: break-word;
		}
		.search{
		    width:300px;
		}
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <!-- Panel Other -->
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>外检信息</h5>
                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">  
                    <div class="col-sm-12">
                        <!-- Example Events -->
                        <div class="example-wrap"> 
                            <div class="example"> 
                            	<div style="" class="demo ui-sortable">
                            		 <div class="row">
			                            <div class="col-sm-3">
			                                <div class="form-group">
			                                    <label>检测机构名称：</label>
						                         <input name="JYJGMC" id="JYJGMC"   type="text"  class="form-control" placeholder="">
			                                </div> 
			                            </div>
			                             <div class="col-sm-3"> 
			                                <div class="form-group">
			                                    <label>外检单号：</label>
			                                    <input name="WJDH" id="WJDH"   type="text"  class="form-control" placeholder="">
			                                </div>
			                            </div>
			                            <div class="col-sm-3">
			                                <div class="form-group">
			                                     <label>检查结果：</label>
						                         <select data-placeholder="选择检查结果" id="WGJCJG" name="WGJCJG"  class="chosen-select form-control">
						                            <option  value="" hassubinfo="true" ></option>
						                            <option value="" hassubinfo="true">全部</option>
												    <option value="1" hassubinfo="true">通过</option>
				                                    <option value="0" hassubinfo="true" >未通过</option>
										        </select>
			                                </div>
			                            </div> 
			                            <div class="col-sm-3" style="padding-top: 22px;">
			                                 <button type="button" class="btn btn-primary" id="search">查询</button>
			                            </div> 
			                        </div>
			                        
			                         <div class="row">
			                            <div class="col-sm-3">
			                                <div class="form-group">
			                                    <label>车架号：</label>
			                                    <input name="CJH" id="CJH"   type="text"  class="form-control" placeholder="">
			                                </div> 
			                            </div>
			                             <div class="col-sm-3"> 
			                              <div class="form-group">
			                                    <label>号牌号码：</label>
			                                    <input  name="HPHM" id="HPHM"   type="text"  class="form-control" placeholder="">
			                                </div> 
			                            </div>
			                            <div class="col-sm-3">
			                            </div> 
			                            <div class="col-sm-3" style="padding-top: 22px;">
			                            </div> 
			                        </div>
			                    </div>
                                <table id="exampleTableEvents" >
                                    <thead>
                                        <tr>
                                            <th data-field="state" data-radio="true"></th>  
                                            <th data-field="ID" data-visible = "false" >id</th>  
								            <th data-field="JYJGMC" >检验机构名称</th> 
								            <th data-field="WJDH" >外检单号</th> 
								            <th data-field="CJH">车架号</th> 
								            <th data-field="HPHM">号牌号码</th>
								            <th data-field="CZXM">车主姓名/单位名称</th> 
								            <th data-field="CZDH">车主电话</th> 
								            <th data-field="WGJCJG" data-formatter="formatterStatus">外观检查结果</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                        <!-- End Example Events -->
                    </div>
                </div>
            </div>
        </div>
        <!-- End Panel Other -->
    </div>
    
    <div id="aut_win"></div>
    <@import.tableManagerImportScript/>
    <script src="${WEB_PATH }/resources/js/plugins/fancybox/jquery.fancybox.js"></script>
    <script src="${WEB_PATH}/resources/js/city-picker.data.js"></script>
	<script src="${WEB_PATH}/resources/js/city-picker.js"></script>
    <script >
    	$(function(){
    		$("#WGJCJG").chosen({width:'100%'});
    		
    		$(window).resize(function () {
		        $('#exampleTableEvents').bootstrapTable('resetView');
		    });
		   
		    function queryParams(params) {
		        var temp = {  
			        limit: params.limit,  
			        offset: params.offset, 
			        JYJGMC:$("#JYJGMC").val(),
			        WJDH:$("#WJDH").val(),
			        WGJCJG:$("#WGJCJG").val(),
			        CJH:$("#CJH").val(),
			        HPHM:$("#HPHM").val(),
			        maxrows: params.limit,
			        pageindex:params.pageNumber,
		        };
		        return temp;
			}
    		//加载table数据
	    	$("#exampleTableEvents").bootstrapTable({
	            url: "${WEB_PATH }/reg/appearancedetection/getPage.do",
	            method: 'get',
	            search:true,
	            pagination:true,
	            pageNumber:1,  
	            pageSize:10,   
	            showRefresh:false, 
	            showColumns:false,
	            detailView:true,
	            iconSize: "outline",
	            toolbar: "#exampleTableEventsToolbar",
	            sidePagination: "server", //设置为服务器端分页
	            queryParams: queryParams,//参数
	            minimumCountColumns: 1, 
	            search: false,    //隐藏搜索框
	            clickToSelect: true,
	            onExpandRow:subTableFormatter,  
	        });
	        
	        $('input.form-control.input-outline').attr("placeholder","请输入商户名称/联系人/联系人电话"); //设置搜索提示信息
	        
        });
        
        function subTableFormatter(index, row, $detail){
			var info = $detail.html('<div id="info"></div>').find('#info');
			info.load("${WEB_PATH}/reg/appearancedetection/view/detail.do?id="+row.ID);
		}
        
         //点击查询搜索
		$("#search").click(function(){
			$("#exampleTableEvents").bootstrapTable('refresh');
		});
        
        
        function success(result){  
			if(result.success == true){ 
				swal({
			        title: "操作成功",
			        text: result.msg
		    	})
		    	$("#exampleTableEvents").bootstrapTable('refresh');
			}else{
				$('#saveBut').attr("disabled",false);    
				swal({
			        title: "操作失败",
			        text: result.msg
		    	})
			}
		}
		
		
		function formatterStatus(val){
			var auditName = "";
			if(val == "1"){
				auditName = '<span class="label label-primary">通过</span>';
			}else{
				auditName = '<span class="label label-danger">未通过</span>';
			}
        	return auditName;
		} 
		
				
		function formatMethod(val){
			var auditName = "";
			if(val == "1"){
				return "双怠速";
			}else if(val == "2"){
				return "稳态工况";
			}else if(val == "3"){
				return "简易瞬态工况";
			}else if(val == "4"){
				return "加载减速";
			}else if(val == "5"){
				return "急加速烟度法";
			}else if(val == "6"){
				return "不透光烟度";
			}else if(val == "7"){
				return "滤纸烟度";
			}
        	return auditName;
		} 
		
		
		
		
		//点击新增按钮
		$("#add").click(function(){
			layer.open({
			      type: 2,
			      title: '<span style="color: #ed5565">新增检测线</span>',
			      shadeClose: false, 
			      shade: 0.3,
			      maxmin: false, //开启最大化最小化按钮
			      area: ['75%', '75%'],
			      content: "${WEB_PATH }/reg/tsline/view/add.do",
			      btn: ['确定','取消'],
			      yes: function(index, layero){
				      var body = layer.getChildFrame('body', index);
				      var iframeWin = window[layero.find('iframe')[0]['name']];
				      iframeWin.saveAddForm();
				  },
				  cancel: function(){
					  layer.closeAll();
				  }
			});
		});
		
		
	     //点击修改按钮
		$("#edit").click(function(){
		    var selectRow = $("#exampleTableEvents").bootstrapTable('getSelections');
            var tsLine = selectRow[0]; 
        	if(1 != selectRow.length){
			    layer.msg('请选择您需要修改的检测线信息！', {icon: 5}); 
			    return ;
	       	} 
			layer.open({
			      type: 2,
			      title: '<span style="color: #ed5565">修改检测线</span>',
			      shadeClose: false, 
			      shade: 0.3,
			      maxmin: false, //开启最大化最小化按钮
			      area: ['75%', '75%'],
			      content: "${WEB_PATH }/reg/tsline/view/edit.do?id="+tsLine.ID,
			      btn: ['确定','取消'],
			      yes: function(index, layero){
				      var body = layer.getChildFrame('body', index);
				      var iframeWin = window[layero.find('iframe')[0]['name']];
				      iframeWin.saveEditForm();
				  },
				  cancel: function(){
					  layer.closeAll();
				  }
			});
		});
		
		
		 //删除检测机线
	     $('#del').click(function () {
        	var selectRow = $("#exampleTableEvents").bootstrapTable('getSelections');
        	if(0 == selectRow.length){
			    layer.msg('请选择您需要删除的检测机构信息！', {icon: 5}); 
			    return ;
        	}
        	
        	layer.confirm('<span style="color: red">您确定要删除该数据?</span>',{icon: 3, title:'系统提示',btn: ['确认','取消']},
    		function(){
        		$.yilinAjax({
				   	  	type:'GET',
				   	  	url:'${WEB_PATH }/reg/tsline/del.do?id=' + selectRow[0].ID, 
				   	  	data:null,
	            		errorcallback:null,
	            		successcallback:success
				});
			});
		});
        
    </script>
</body>

</html>